﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UFIDA.UBF.Report.App.UI.ProcessStrategy;
using UFIDA.UBF.Query.CaseModel;
using UFIDA.U9.UI.PDHelper;
using UFSoft.UBF.Report.UI.ReportView;
using System.Collections.Specialized;
using UFIDA.U9.SCM.Pub.ReportStrategy;
using UFSoft.UBF.Report.Filter;

namespace UFIDA.U9.Cust.Demo.PX.RptProcessStrategy
{
    class DemoSORptProcessStrategy : ReportProcessStrategy
    {
        public DemoSORptProcessStrategy() : base() { }
        public DemoSORptProcessStrategy(LoadReportTemplateArgs args, Case useCase) : base(args, useCase) { }

        /// <summary>
        /// 格式处理
        /// 用于动态处理格式，依据控制参数调整模板格式
        /// </summary>
        protected override void ProcessFormat()
        {
            base.ProcessFormat();
        }

        /// <summary>
        /// 默认值
        /// 处理条件项定义信息：参数赋默认值、调整参照、弹性域处理
        /// </summary>
        /// <param name="usercase"></param>
        /// <param name="caseDefine"></param>
        /// <returns></returns>
        public override CaseDefine ProcessCaseDefine(Case usercase, CaseDefine caseDefine)
        {
            caseDefine = base.ProcessCaseDefine(usercase, caseDefine);
            // 组织默认值
            ReportStrategyHelper.SetDefaultValue(
                caseDefine.FilterDefines.GetObjectByName("Org"),
                PDContext.Current.OrgRef.NameColumn,
                PDContext.Current.OrgRef.CodeColumn,
                enuOperatorListType.Equal);

            return caseDefine;
        }




        /// <summary>
        /// 钻取
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public override ThroughToDocParameter GetThroughToDocParameter(ReportDrillthroughArgs args)
        {
            ////料品
            //if (args.Parameters["ItemInfo_ItemCode"] != null)
            //{
            //    ThroughToDocParameter docPar = new ThroughToDocParameter();

            //    //FormID 料品
            //    docPar.PartID = "053a1be3-2c56-428b-b221-b5291644f2cb";
            //    NameValueCollection pars = new NameValueCollection();
            //    //parm.DocID,单据ID
            //    pars.Add("ID", args.Parameters["ItemInfo_ItemID"]);
            //    //DocOrg,单据组织ID
            //    //pars.Add(UFIDA.U9.UI.Commands.CommandArgsConstant.TargetOrgParamFlag, args.Parameters["ItemMaster_Org_ID"]);
            //    docPar.TargetParms = pars;
            //    return docPar;
            //}
            //if (args.Parameters["SO_DocNo"] != null)
            //{
            //    ThroughToDocParameter docPar = new ThroughToDocParameter();

            //    //FormID 料品
            //    docPar.PartID = "3c3dfb69-d07e-46a9-a5ce-b373c0946beb";
            //    NameValueCollection pars = new NameValueCollection();
            //    //parm.DocID,单据ID
            //    pars.Add("ID", args.Parameters["SO_ID"]);
            //    //DocOrg,单据组织ID
            //    //pars.Add(UFIDA.U9.UI.Commands.CommandArgsConstant.TargetOrgParamFlag, args.Parameters["ItemMaster_Org_ID"]);
            //    docPar.TargetParms = pars;
            //    return docPar;
            //}
            //if (args.Parameters["DocNo"] != null)
            //{
            //    ThroughToDocParameter docPar = new ThroughToDocParameter();

            //    //FormID 料品
            //    docPar.PartID = "3c3dfb69-d07e-46a9-a5ce-b373c0946beb";
            //    NameValueCollection pars = new NameValueCollection();
            //    //parm.DocID,单据ID
            //    pars.Add("ID", args.Parameters["ID"]);
            //    //DocOrg,单据组织ID
            //    //pars.Add(UFIDA.U9.UI.Commands.CommandArgsConstant.TargetOrgParamFlag, args.Parameters["ItemMaster_Org_ID"]);
            //    docPar.TargetParms = pars;
            //    return docPar;
            //}
            return base.GetThroughToDocParameter(args);
        }
    }
}